//
// Created by nicemoe on 2021/7/31.
//

#include <iostream>

using namespace std;

struct inflatable {
    char name[20];
    float volume;
    double price;
};

struct perks {
    int key_number;
    char car[12];
} ms_tony, mr_smith{
        7,
        "packard"

}, ms_jones{
        6,
        "packard"

};
//枚举
enum testtype {
    red = 10, orange = 20, yellow = 30
};
//共用体
union one4all {
    int int_val;
    long long_val;
    double double_val;
};

int main() {
    inflatable bouquet
            {
                    "sunflowers",
                    0.20,
                    12.49
            };
    inflatable choice;
    cout << "bouquet: " << bouquet.name << " for $";
    cout << bouquet.price << endl;

    choice = bouquet;
    cout << "choice: " << choice.name << " for $";
    cout << choice.price << endl;
    ms_tony = ms_jones;
    cout << ms_jones.key_number << " " << mr_smith.key_number << " " << ms_tony.key_number << endl;

    inflatable *cc = new inflatable;
    cc->price = 20;
    cout << cc->price << endl;
    delete cc;
    cout << "共用体" << endl;
    one4all pail;
    pail.int_val = 15;
    cout << pail.int_val << endl;
    pail.double_val = 10.1;
    cout << pail.double_val << endl;
    cout << red << endl;
    return 0;
}
